package com.example.usersvc.config;



import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import java.util.List;

@EnableWebMvc
@Configuration
public class OpenAPIConfiguration {
    @Bean
    public OpenAPI defineOpenApi (){
        Server server = new Server();
        server.setUrl("http://localhost:8081");
        server.setDescription("User Service");

        Contact myContact = new Contact();
        myContact.setName("leo");
        myContact.setEmail("2022141125@bupt.com");

        Info information = new Info().title("eBond API")
                .version("1.0")
                .description("This API exposes endpoints to accounts.")
                .contact(myContact);

        return new OpenAPI().info(information).servers(List.of(server));
    }
}
